package com.wfg.blog.contorller;

import com.wfg.blog.service.TagService;
import com.wfg.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController //返回的是Json数据
@RequestMapping("tags")
public class TagController {

    @Autowired
    private TagService tagService;

    // /tags/hot

    /**
     * 最热标签
     * @return
     */
    @GetMapping("hot")
    public Result hot(){
        int limit = 6;
        return tagService.hots(limit);
    }
    /**
     * 查询所有标签
     * @return
     */
    @GetMapping()
    public Result findAll(){

        return tagService.findAll();
    }
    /**
     * 查询所有文章标签
     * @return
     */
    @GetMapping("detail")
    public Result findAllDetail(){

        return tagService.findAllDetail();
    }
    /**
     * 查询文章id标签
     * @return
     */
    @GetMapping("detail/{id}")
    public Result findDetailById(@PathVariable("id") Long id){

        return tagService.findDetailById(id);
    }
}
